<template>
  <div class="app-content">
    <a-list item-layout="vertical" size="large" :data-source="listData">
      <template #footer>
        <!-- <div>列表页脚</div> -->
      </template>
      <template #renderItem="{ item }">
        <a-list-item key="item.title">
          <template #actions>
            <span v-for="{ type, text } in actions" :key="text">
              <component :is="type" style="margin-right: 8px" />
              {{ text }}
            </span>
          </template>
          <template #extra>
            <img width="272" alt="logo" src="https://gw.alipayobjects.com/zos/rmsportal/mqaQswcyDLcXyDKnZfES.png" />
          </template>
          <a-list-item-meta :description="item.description">
            <template #title>
              <a :href="item.href">{{ item.title }}</a>
            </template>
            <!-- 头像 -->
            <!-- <template #avatar><a-avatar :src="item.avatar" /></template> -->
          </a-list-item-meta>
          {{ item.content }}
        </a-list-item>
      </template>
    </a-list>
  </div>
</template>

<script setup lang="ts">
import { StarOutlined, LikeOutlined, MessageOutlined } from '@ant-design/icons-vue'

defineOptions({ name: 'Dashboard' })

const loading = ref<boolean>(true)

interface listProps {
  href: string
  title: string
  avatar?: string
  description: string
  content: string
}

const listData: listProps[] = []
for (let i = 0; i < 23; i++) {
  listData.push({
    href: 'https://www.antdv.com/',
    title: `xxxx标题 ${i}`,
    avatar: 'https://joeschmoe.io/api/v1/random',
    description: '描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述.',
    content: '内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容',
  })
}
const actions = [
  {
    type: StarOutlined,
    text: '156',
  },
  {
    type: LikeOutlined,
    text: '156',
  },
  {
    type: MessageOutlined,
    text: '2',
  },
]
onMounted(() => {
  setTimeout(() => {
    loading.value = false
  }, 2000)
})
</script>

<style lang="scss" scoped>
a {
  display: block;
}
</style>
